package com.haoshuang.zhouzhoubang.ui.adapter

import android.view.ViewGroup

import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.databinding.ItemFwBinding
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter

/**
 * 订单模块中的订单列表适配器
 * */
class ServiceAdapter(data: MutableList<String>) :
    BaseBindingQuickAdapter<String, ItemFwBinding>(data){

    override fun onBindViewHolder(holder: BaseBindingHolder, position: Int, item: String?) {
        if (item == null) return
        val binding = ItemFwBinding.bind(holder.itemView)
        binding.apply {


            var arr=item.split(",")
            var list= arrayListOf<String>()
            list.addAll(arr)
            var adapter=Inage4Adapter(list)
            val layoutManager: LinearLayoutManager = object : LinearLayoutManager(context) {
                override fun generateDefaultLayoutParams(): RecyclerView.LayoutParams? {
                    return RecyclerView.LayoutParams(
                        ViewGroup.LayoutParams.MATCH_PARENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT
                    )
                }
            }
            layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
            ivImage.setLayoutManager(layoutManager)
            ivImage.adapter=adapter
            when(holder.layoutPosition){
                0->{
                    tvName.text="服务内容"
                }
                1->{
                    tvName.text="图文详情"
                }
                2->{
                    tvName.text="常见问题"
                }
            }

        }

    }

}